import router from "@/router";
import {getToken} from "@/utils/auth";

router.beforeEach(async (to, from, next) => {
    if(to.path==='/portal'){
        next();
    }else{
        const hasToken = getToken()
        if (hasToken) {
            next()
        } else {
            if(to.path!='/login'){
                next('/login')
            }
            next()
        }
    }
})
